var obj = null;
var curItemId = 1;
var playList = new Array();
var boxWidth = 451;

$(function(){
	if(_isAli){
		IMPlayer.CheckConnection ();
		IMPlayer.UpdateStatusSignal.connect(OnStateChanged);
	}
	window.addEventListener("pagehide", pageHide, false);
	
	var v = JP.getVolume();
	$('#volumeBox').html(v);
		
	obj = {icon:"images/1.png","channel_id":1,"name":"华语"};		//通过session获取
	initData("next",afterInitData);
});

function pageHide(){
	IMPlayer.Stop();
}


function afterInitData(type,list){
	if(type == "next"){
		curItemId = playList.length + 1;
		for(var i = 0;i<list.length;i++){
			playList.push(list[i]);
		}
	}else{
		curItemId = list.length;
		for(var i = 0;i<list.length;i++){
			playList.unshift(list[i]);
		}
	}
	play(playList[curItemId - 1]);
}